import java.util.Arrays;

public class Demo1 {
    public static String setstring (String str) {
        int len = str.length();
        StringBuffer ret = new StringBuffer();
        int[] standard = new int[26 * 2];//前26是大写
        for (int i = 0; i < len; i++) {
            char c = str.charAt(i);
            if(Character.isUpperCase(c)) {
                int index = c - 'A';
                if(standard[index] == 0) {
                    ret.append(c);
                    standard[index] = 1;
                }
            }
            if(Character.isLowerCase(c)) {
                int index = c - 'a' + 26;
                if(standard[index] == 0) {
                    ret.append(c);
                    standard[index] = 1;
                }
            }
        }
        return ret.toString();
    }

    public static void merge(int[] A, int m, int[] B, int n) {
        int indexA = m - 1;
        int indexB = n - 1;
        int last = m + n - 1;
        while(indexB >= 0 && indexA >= 0) {
            if(A[indexA] >= B[indexB]) {
                A[last--] = A[indexA--];
            } else {
                A[last--] = B[indexB--];
            }
        }
        //A先结束
        if(indexA < 0) {
            for (int i = 0; i <= indexB; i++) {
                A[i] = B[i];
            }
        }
    }

    public static void main(String[] args) {
        //[4,5,6],[1,2,3]
        int[] a = {4,5,6,0,0,0};
        int[] b = {1,2,3};
        merge(a, 3, b, 3);
        System.out.println(Arrays.toString(a));
    }


}
